package com.itrip.itripauth.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itrip.itripauth.entity.HotelOrder;
import com.itrip.itripauth.vo.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 订单表 Mapper 接口
 * </p>
 *
 * @author 四阶段项目二组
 * @since 2020-02-25
 */
public interface HotelOrderMapper extends BaseMapper<HotelOrder> {

    PersonalOrderRoomVO getHotelOrderRoomInfoById(@Param(value = "id") Long id) throws Exception;


    /**
     * 查询用户订单
     *
     * @param hotelOrderVo
     * @return
     */
    List<HotelOrder> getPersonalOrderList(HotelOrderVo hotelOrderVo);

    /**
     * 获取订单记录数
     *
     * @param hotelOrderVo
     * @return
     */
    Integer getPersonalOrderInfoCount(HotelOrderVo hotelOrderVo);

    /**
     * 查询订单详情
     *
     * @param id
     * @return
     */
    OrderVo getPersonalOrderInfo(Long id);

    /**
     * 根据ID获取订单信息
     *
     * @param id
     * @return
     */
    HotelOrder getHotelOrderById(Long id);

    /**
     * 查询入住信息
     *
     * @param orderId
     * @return
     */
    OrderRoomInfoVo getPersonalOrderRoomInfo(@Param("orderId") Integer orderId);

    List<OrderLinkUserVo> getOrderLinkUserListByMap(Map<String, Object> param);


    //根据支付宝订单号查询当前订单信息
    HotelOrder loadHotelOrder(String orderNo);


    /**
     * 获取房间ID
     *
     * @param hotelId
     * @param orderId
     * @return
     */
    HotelOrder getHotelOrderRoomId(@Param("hotelId") Integer hotelId, @Param("orderId") Integer orderId);

    /**
     * 预定房间
     *
     * @param addOrderVo
     * @return
     */
    int addHotelOrder(AddOrderVo addOrderVo);

    /**
     * 返回修改订单
     *
     * @return
     */
    int updateHotelOrder(AddOrderVo addOrderVo);


    List<HotelOrder> getHotelOrderList();


    /**
     *  根据id循环修改订单状态
     */
    int cycleChangesHotelOrder(@Param("id") Long id);


}
